package online.heycm.rbac.common.utils;

import online.heycm.platform.common.tools.cipher.core.MD5Core;
import online.heycm.rbac.common.constant.Constant;

/**
 * MD5加密工具
 *
 * @author hey
 * @version 1.0
 * @date 2024/1/12 16:59
 */
public class Md5Util {
    private Md5Util() {
    }

    public static String encrypt(String content) {
        return MD5Core.encrypt(content);
    }

    public static String encrypt(String content, String salt) {
        return MD5Core.encrypt(content, salt);
    }

    public static String generateSalt() {
        return MD5Core.generateSalt(Constant.MD5_SALT_LENGTH);
    }

    public static void main(String[] args) {
        String salt = generateSalt();
        System.out.println("salt = " + salt);
        String encrypt = encrypt("123456", salt);
        System.out.println("encrypt = " + encrypt);
    }
}
